/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package py.com.peluq.model.entity;

import java.io.Serializable;
import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author Diego_M
 */
@Entity
@Table(name = "det_facturas", catalog = "peludb", schema = "")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "DetFacturas.findAll", query = "SELECT d FROM DetFacturas d"),
    @NamedQuery(name = "DetFacturas.findByNrofac", query = "SELECT d FROM DetFacturas d WHERE d.detFacturasPK.nrofac = :nrofac"),
    @NamedQuery(name = "DetFacturas.findByProductosProdCod", query = "SELECT d FROM DetFacturas d WHERE d.detFacturasPK.productosProdCod = :productosProdCod"),
    @NamedQuery(name = "DetFacturas.findByCant", query = "SELECT d FROM DetFacturas d WHERE d.cant = :cant"),
    @NamedQuery(name = "DetFacturas.findByPrecio", query = "SELECT d FROM DetFacturas d WHERE d.precio = :precio"),
    @NamedQuery(name = "DetFacturas.findByExenta", query = "SELECT d FROM DetFacturas d WHERE d.exenta = :exenta"),
    @NamedQuery(name = "DetFacturas.findByIva5", query = "SELECT d FROM DetFacturas d WHERE d.iva5 = :iva5"),
    @NamedQuery(name = "DetFacturas.findByIva10", query = "SELECT d FROM DetFacturas d WHERE d.iva10 = :iva10")})
public class DetFacturas implements Serializable {
    private static final long serialVersionUID = 1L;
    @EmbeddedId
    protected DetFacturasPK detFacturasPK;
    @Column(name = "cant")
    private Integer cant;
    @Column(name = "precio")
    private Integer precio;
    @Column(name = "exenta")
    private Integer exenta;
    @Column(name = "iva5")
    private Integer iva5;
    @Column(name = "iva10")
    private Integer iva10;
    @JoinColumn(name = "productos_prod_cod", referencedColumnName = "prod_cod", nullable = false, insertable = false, updatable = false)
    @ManyToOne(optional = false)
    private Productos productos;
    @JoinColumn(name = "Nro_fac", referencedColumnName = "Nro_fac", nullable = false, insertable = false, updatable = false)
    @ManyToOne(optional = false)
    private Facturas facturas;

    public DetFacturas() {
    }

    public DetFacturas(DetFacturasPK detFacturasPK) {
        this.detFacturasPK = detFacturasPK;
    }

    public DetFacturas(int nrofac, int productosProdCod) {
        this.detFacturasPK = new DetFacturasPK(nrofac, productosProdCod);
    }

    public DetFacturasPK getDetFacturasPK() {
        return detFacturasPK;
    }

    public void setDetFacturasPK(DetFacturasPK detFacturasPK) {
        this.detFacturasPK = detFacturasPK;
    }

    public Integer getCant() {
        return cant;
    }

    public void setCant(Integer cant) {
        this.cant = cant;
    }

    public Integer getPrecio() {
        return precio;
    }

    public void setPrecio(Integer precio) {
        this.precio = precio;
    }

    public Integer getExenta() {
        return exenta;
    }

    public void setExenta(Integer exenta) {
        this.exenta = exenta;
    }

    public Integer getIva5() {
        return iva5;
    }

    public void setIva5(Integer iva5) {
        this.iva5 = iva5;
    }

    public Integer getIva10() {
        return iva10;
    }

    public void setIva10(Integer iva10) {
        this.iva10 = iva10;
    }

    public Productos getProductos() {
        return productos;
    }

    public void setProductos(Productos productos) {
        this.productos = productos;
    }

    public Facturas getFacturas() {
        return facturas;
    }

    public void setFacturas(Facturas facturas) {
        this.facturas = facturas;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (detFacturasPK != null ? detFacturasPK.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof DetFacturas)) {
            return false;
        }
        DetFacturas other = (DetFacturas) object;
        if ((this.detFacturasPK == null && other.detFacturasPK != null) || (this.detFacturasPK != null && !this.detFacturasPK.equals(other.detFacturasPK))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "py.com.peluq.model.entity.DetFacturas[ detFacturasPK=" + detFacturasPK + " ]";
    }
    
}
